package co.fitstart.weapp.api.dao;

import java.util.List;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Limit;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;

import co.fitstart.entity.principal.Principal;
import co.fitstart.entity.principal.PrincipalMessage;

/**
 * @ClassName: CoachMessageDao  
 * @author: cuteHU  
 * @date: 2018年12月3日
 */
@Dao("hibernate")
public interface CoachMessageDao {
    /**
     * @Description: 查出消息列表
     * @param principal
     * @param beginIndex
     * @param maxResult
     * @return  List<PrincipalMessage>
     */
    @Limit
    @Query("FROM PrincipalMessage WHERE disabled = false AND principal = :principal ORDER BY createTime DESC")
    public List<PrincipalMessage> list(@Variable("principal")Principal principal, @Variable("beginIndex") int beginIndex, @Variable("maxResult") int maxResult);
    
    /**
     * @Description: 查出消息的详情信息
     * @param       
     * @return  PrincipalMessage
     */
    @Query("FROM PrincipalMessage WHERE disabled = false AND messageId = :messageId")
    public PrincipalMessage load(@Variable("messageId") Long messageId);
    
}
